<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div style="width:600px ; height:400px"></div>
    <script src="./lib/echarts.min.js"></script>
    <script>
        let myChart =echarts.init(document.querySelector('div'))
         let option ={
            title:{
    text:'我的折线图',
    left:'center'
            },
            grid:{
                top:120
            },
 xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    
axisLabel: {
    color:'red'
}
  },
  yAxis: {
    type: 'value',
    
splitLine:{
    
lineStyle:{
    color:'red'
}
}
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
      name:'第一季度'
    },
    {
      data: [250, 230, 224, 218, 135, 147, 160],
      type: 'bar',
      name:'第二季度'
    }
  ],
//   需要和series中的name一起使用
  legend:{
    top:50
  },
  legend: {
        top: 50
      },
      color: ['red', {
        type: 'linear',
        x: 0,
        y: 0,
        x2: 0,
        y2: 1,
        colorStops: [{
          offset: 0, color: 'red' // 0% 处的颜色
        }, {
          offset: 1, color: 'blue' // 100% 处的颜色
        }],
        global: false // 缺省为 false
      }, {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0, color: 'black' ,
            offset: 1, color: '#fff' 
          }],
          global: false 
        }],
      tooltip: {
        trigger: 'axis' 
      }
  
         }
         myChart.setOption(option)
    </script>
</body>
</html>